package com.arajuuri.catinvaders;

import com.arajuuri.catinvaders.fileoperations.Images;
import java.awt.Image;

/**
 * <p>Title: Cat Invaders</p>
 * <p>Description: A space invaders clone with cats</p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author Semi Arajuuri
 * @version 1.0
 */
public class Cat extends GraphicalObjectAdapter {

    public Cat() {
        img = images.loadImage("misu.png");
    }

    public Cat(String imgName) {
        img = images.loadImage(imgName);
    }

    public Image getImage() {
        return img;
    }

    public boolean detectCollision(int x, int y) {

        if (x > this.x && x < this.x + img.getWidth(null) && !this.isHidden()) {
            if (y > this.y && y < this.y + img.getWidth(null)) {
                this.hide();
                return true;
            }
        }
        return false;
    }
}
